#ifndef _KTITLE_H
#define _KTITLE_H

#include <iostream.h>
#include "CPstring.h"

// **********************************************
// In this file not all private section data/functions
// are provided!!
// **********************************************
//
// Kwic (Key Word in Context) KwicTitle class
//
// Owen Astrachan and Michael Loeb
// 2/6/97
//
// A KwicTitle is identified by a title and a keyword in the title
// For example, the title "Woman on the Edge of Time"
// will generate three KwicTitles:
//     one for "Woman", one for "Edge", and one for "Time"
//
// a KwicTitle is constructed, or built, from the title and the
// keyword
//   
// KwicTitle(Title * t = 0, const string * keyWord = 0)
//       
//     -- construct a KwicTitle from a title and a string
//        default parameters allow definitions of Vectors of KwicTitles
//
// void Build(Title * t, const strong * keyWord)
//
//     -- build a KwicTitle from a title and string (e.g.,
//        after it is constructed)
//
// bool Less(const KwicTitle & rhs) const
//
//     -- returns true if *this < rhs, comparison based only on
//        lexicographic comparison of keywords, no other parts of
//        title used
//
// void Print(ostream & os) const
//
//     -- print a KwicTitle in a nice way
//        the keyword is in ALL CAPS, roughly centered, other
//        words are all lower case, for example:
//
//                          woman on the EDGE of time 
//                  woman on the edge of TIME 
//                                       WOMAN on the edge of time 
//

class Title;

class KwicTitle
{
  public:
    KwicTitle(Title * t = 0, const string * keyWord = 0);
    void Build(Title * t, const string * keyWord);
    
    bool Less(const KwicTitle & rhs) const;
    void Print(ostream & out) const;

  private:
    
    Title * myTitle;             // pointer to title
    const string * myKeyword;    // pointer to Key Word
};

bool operator <  (const KwicTitle & lhs, const KwicTitle & rhs);
ostream & operator << (ostream & os, const KwicTitle & kt);


#endif
